package ThreadPool.chapter3;

import java.util.concurrent.TimeUnit;

/**
 * @author oyz
 * @version 1.0.4
 * @description: this逸出,一般出现在多线程中
 * @date 2022/12/21 21:03
 */
public class CtorThread {
    private String str;

    public CtorThread(String str) {
        new Thread(this::read).start();
        try {
            TimeUnit.MILLISECONDS.sleep(10);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        str = str;
    }

    void read(){
        System.out.println("str="+str);
    }

    public static void main(String[] args) {
        new CtorThread("hello");
    }
}
